import random
num = random.randint(1, 10)
print("您有3次机会猜测数字，请输入数字:")
guess = int(input())
if guess == num:
    print("恭喜你猜对了")
else:
    if guess > num:
        print("大了")
    else:
        print("小了")
    guess = int(input("您有2次机会猜测数字，请输入数字:"))
    if guess == num:
        print("恭喜你猜对了")
    else:
        if guess > num:
            print("大了")
        else:
            print("小了")
        guess = int(input("您有2次机会猜测数字，请输入数字:"))
        if guess == num:
            print("恭喜你猜对了")
        else:
            if guess > num:
                print("大了")
            else:
                print("小了")
            print("3次机会已用完，您没猜出来")
print("正确的数字是%d" % num)